.class public Lcom/zuimeia/ui/lockpattern/LockPatternUtils;
.super Ljava/lang/Object;
.source "LockPatternUtils.java"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 27
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static patternToHash(Ljava/util/List;)[B
    .registers 10
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Lcom/zuimeia/ui/lockpattern/ICell;",
            ">(",
            "Ljava/util/List",
            "<TT;>;)[B"
        }
    .end annotation

    .prologue
    .line 88
    .local p0, "pattern":Ljava/util/List;, "Ljava/util/List<TT;>;"
    if-nez p0, :cond_4

    .line 89
    const/4 v1, 0x0

    .line 103
    :goto_3
    return-object v1

    .line 92
    :cond_4
    invoke-interface {p0}, Ljava/util/List;->size()I

    move-result v5

    .line 93
    .local v5, "patternSize":I
    new-array v6, v5, [B

    .line 94
    .local v6, "res":[B
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_b
    if-ge v2, v5, :cond_24

    .line 95
    invoke-interface {p0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/zuimeia/ui/lockpattern/ICell;

    .line 96
    .local v0, "cell":Lcom/zuimeia/ui/lockpattern/ICell;
    invoke-virtual {v0}, Lcom/zuimeia/ui/lockpattern/ICell;->getRow()I

    move-result v7

    mul-int/lit8 v7, v7, 0x3

    invoke-virtual {v0}, Lcom/zuimeia/ui/lockpattern/ICell;->getColumn()I

    move-result v8

    add-int/2addr v7, v8

    int-to-byte v7, v7

    aput-byte v7, v6, v2

    .line 94
    add-int/lit8 v2, v2, 0x1

    goto :goto_b

    .line 99
    .end local v0    # "cell":Lcom/zuimeia/ui/lockpattern/ICell;
    :cond_24
    :try_start_24
    const-string v7, "SHA-1"

    invoke-static {v7}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v3

    .line 100
    .local v3, "md":Ljava/security/MessageDigest;
    invoke-virtual {v3, v6}, Ljava/security/MessageDigest;->digest([B)[B
    :try_end_2d
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_24 .. :try_end_2d} :catch_2f

    move-result-object v1

    .line 101
    .local v1, "hash":[B
    goto :goto_3

    .line 102
    .end local v1    # "hash":[B
    .end local v3    # "md":Ljava/security/MessageDigest;
    :catch_2f
    move-exception v4

    .local v4, "nsa":Ljava/security/NoSuchAlgorithmException;
    move-object v1, v6

    .line 103
    goto :goto_3
.end method

.method public static patternToHashString(Ljava/util/List;)Ljava/lang/String;
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Lcom/zuimeia/ui/lockpattern/ICell;",
            ">(",
            "Ljava/util/List",
            "<TT;>;)",
            "Ljava/lang/String;"
        }
    .end annotation

    .prologue
    .line 108
    .local p0, "pattern":Ljava/util/List;, "Ljava/util/List<TT;>;"
    invoke-static {p0}, Lcom/zuimeia/ui/lockpattern/LockPatternUtils;->patternToHash(Ljava/util/List;)[B

    move-result-object v0

    .line 109
    .local v0, "patternHash":[B
    if-eqz v0, :cond_b

    .line 110
    invoke-static {v0}, Lcom/zuimeia/ui/lockpattern/LockPatternUtils;->toHex([B)Ljava/lang/String;

    move-result-object v1

    .line 114
    :goto_a
    return-object v1

    :cond_b
    const-string v1, ""

    goto :goto_a
.end method

.method public static patternToHashStringOld(Ljava/util/List;)Ljava/lang/String;
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Lcom/zuimeia/ui/lockpattern/ICell;",
            ">(",
            "Ljava/util/List",
            "<TT;>;)",
            "Ljava/lang/String;"
        }
    .end annotation

    .prologue
    .line 118
    .local p0, "pattern":Ljava/util/List;, "Ljava/util/List<TT;>;"
    invoke-static {p0}, Lcom/zuimeia/ui/lockpattern/LockPatternUtils;->patternToHash(Ljava/util/List;)[B

    move-result-object v0

    .line 119
    .local v0, "patternHash":[B
    if-eqz v0, :cond_c

    .line 120
    new-instance v1, Ljava/lang/String;

    invoke-direct {v1, v0}, Ljava/lang/String;-><init>([B)V

    .line 123
    :goto_b
    return-object v1

    :cond_c
    const-string v1, ""

    goto :goto_b
.end method

.method public static patternToString(Ljava/util/List;)Ljava/lang/String;
    .registers 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Lcom/zuimeia/ui/lockpattern/ICell;",
            ">(",
            "Ljava/util/List",
            "<TT;>;)",
            "Ljava/lang/String;"
        }
    .end annotation

    .prologue
    .line 67
    .local p0, "pattern":Ljava/util/List;, "Ljava/util/List<TT;>;"
    if-nez p0, :cond_5

    .line 68
    const-string v4, ""

    .line 77
    :goto_4
    return-object v4

    .line 70
    :cond_5
    invoke-interface {p0}, Ljava/util/List;->size()I

    move-result v2

    .line 72
    .local v2, "patternSize":I
    new-array v3, v2, [B

    .line 73
    .local v3, "res":[B
    const/4 v1, 0x0

    .local v1, "i":I
    :goto_c
    if-ge v1, v2, :cond_25

    .line 74
    invoke-interface {p0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/zuimeia/ui/lockpattern/ICell;

    .line 75
    .local v0, "cell":Lcom/zuimeia/ui/lockpattern/ICell;
    invoke-virtual {v0}, Lcom/zuimeia/ui/lockpattern/ICell;->getRow()I

    move-result v4

    mul-int/lit8 v4, v4, 0x3

    invoke-virtual {v0}, Lcom/zuimeia/ui/lockpattern/ICell;->getColumn()I

    move-result v5

    add-int/2addr v4, v5

    int-to-byte v4, v4

    aput-byte v4, v3, v1

    .line 73
    add-int/lit8 v1, v1, 0x1

    goto :goto_c

    .line 77
    .end local v0    # "cell":Lcom/zuimeia/ui/lockpattern/ICell;
    :cond_25
    new-instance v4, Ljava/lang/String;

    invoke-direct {v4, v3}, Ljava/lang/String;-><init>([B)V

    goto :goto_4
.end method

.method public static stringToNumberPattern(Ljava/lang/String;)Ljava/util/List;
    .registers 7
    .param p0, "string"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/List",
            "<",
            "Lcom/zuimeia/ui/lockpattern/LockNumberView$Cell;",
            ">;"
        }
    .end annotation

    .prologue
    .line 51
    new-instance v3, Ljava/util/ArrayList;

    invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

    .line 53
    .local v3, "result":Ljava/util/List;, "Ljava/util/List<Lcom/zuimeia/ui/lockpattern/LockNumberView$Cell;>;"
    invoke-virtual {p0}, Ljava/lang/String;->getBytes()[B

    move-result-object v1

    .line 54
    .local v1, "bytes":[B
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_a
    array-length v4, v1

    if-ge v2, v4, :cond_1d

    .line 55
    aget-byte v0, v1, v2

    .line 56
    .local v0, "b":B
    div-int/lit8 v4, v0, 0x3

    rem-int/lit8 v5, v0, 0x3

    invoke-static {v4, v5}, Lcom/zuimeia/ui/lockpattern/LockNumberView$Cell;->of(II)Lcom/zuimeia/ui/lockpattern/LockNumberView$Cell;

    move-result-object v4

    invoke-interface {v3, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 54
    add-int/lit8 v2, v2, 0x1

    goto :goto_a

    .line 58
    .end local v0    # "b":B
    :cond_1d
    return-object v3
.end method

.method public static stringToPattern(Ljava/lang/String;)Ljava/util/List;
    .registers 7
    .param p0, "string"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/List",
            "<",
            "Lcom/zuimeia/ui/lockpattern/LockPatternView$Cell;",
            ">;"
        }
    .end annotation

    .prologue
    .line 35
    new-instance v3, Ljava/util/ArrayList;

    invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

    .line 37
    .local v3, "result":Ljava/util/List;, "Ljava/util/List<Lcom/zuimeia/ui/lockpattern/LockPatternView$Cell;>;"
    invoke-virtual {p0}, Ljava/lang/String;->getBytes()[B

    move-result-object v1

    .line 38
    .local v1, "bytes":[B
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_a
    array-length v4, v1

    if-ge v2, v4, :cond_1d

    .line 39
    aget-byte v0, v1, v2

    .line 40
    .local v0, "b":B
    div-int/lit8 v4, v0, 0x3

    rem-int/lit8 v5, v0, 0x3

    invoke-static {v4, v5}, Lcom/zuimeia/ui/lockpattern/LockPatternView$Cell;->of(II)Lcom/zuimeia/ui/lockpattern/LockPatternView$Cell;

    move-result-object v4

    invoke-interface {v3, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 38
    add-int/lit8 v2, v2, 0x1

    goto :goto_a

    .line 42
    .end local v0    # "b":B
    :cond_1d
    return-object v3
.end method

.method private static toHex([B)Ljava/lang/String;
    .registers 7
    .param p0, "ary"    # [B

    .prologue
    .line 151
    const-string v0, "0123456789ABCDEF"

    .line 152
    .local v0, "hex":Ljava/lang/String;
    const-string v2, ""

    .line 153
    .local v2, "ret":Ljava/lang/String;
    const/4 v1, 0x0

    .local v1, "i":I
    :goto_5
    array-length v3, p0

    if-ge v1, v3, :cond_43

    .line 154
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "0123456789ABCDEF"

    aget-byte v5, p0, v1

    shr-int/lit8 v5, v5, 0x4

    and-int/lit8 v5, v5, 0xf

    invoke-virtual {v4, v5}, Ljava/lang/String;->charAt(I)C

    move-result v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 155
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "0123456789ABCDEF"

    aget-byte v5, p0, v1

    and-int/lit8 v5, v5, 0xf

    invoke-virtual {v4, v5}, Ljava/lang/String;->charAt(I)C

    move-result v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 153
    add-int/lit8 v1, v1, 0x1

    goto :goto_5

    .line 157
    :cond_43
    return-object v2
.end method
